<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=9; IE=8; IE=7; IE=EDGE">
<title>修改学员考试成绩信息</title>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script type="text/javascript" src="../../js/jquery.pagination.js"></script>
<script type="text/javascript" src="../../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="../../js/validata.js"></script>
<script type="text/javascript" src="../../js/alert.js"></script>
<link rel="stylesheet" type="text/css" href="../../css/bootstrap.css">
</head>
<body>
	<form id="form1">
		<table class="table table-bordered .table-condensed">
			<tr>
				<td>培训部分:</td>
				<td id="keMu"></td>
				<td>考试成绩:</td>
				<td>
					<input type="text" name="score" id="score"  class="required maxlength:3"/>
					<input type="hidden" name="id"/>
				</td>
			</tr>
			<tr>
				<td>考试时间:</td>
				<td>
					<input type="text" name="time" id="time" class="required"/>
				</td>
				<td>考试地点:</td>
				<td>
					<input type="text" name="place" id="place" class="required"/>
				</td>			
			</tr>
			<tr>
				<td colspan="4" style="text-align: center;">
					<button type="button" onclick="updateKeMuResult();" class="btn btn-info">修改</button>
				</td>
			</tr>
		</table>
	</form>
    <script type="text/javascript">
    	var href = location.href.split("=");
    	var id = href[1];
    	getKeMuResult(id);
    	
    	//查看员考试成绩
    	function getKeMuResult(id){
	    	$.ajax({
	    		url : "../../keMuResult/get.ao",
	    		type : 'POST',
	    		data : {
	    			"id" : id
	    		},
	    		beforeSend : ajaxstar,
	    		complete : ajaxend,
	    		cache : false,
	    		dataType : "json",
	    		success : function(data) {
	    			if (data["state"] == "success") {
    					$("#form1").find("input").each(function(){
    						var name = $(this).attr("name");
    						if(name != null && typeof(name) != "undefined"){
    							$(this).val(data["result"][name]);
    						}
    					});
    					$("#keMu").html(data["result"]["keMu"]);
    				} else {
    					sAlert(data["result"]);
    				}
    			}
	    	});
    	}
    	
    	//修改学员的考试成绩
    	function updateKeMuResult(){
    		if(validata("form1")){
    			$.ajax({
    				url : "../../keMuResult/update.ao",
    				type : 'POST',
    				data : $("#form1").serialize(),
    				cache : false,
    				dataType : "json",
    				success : function(data){
    					sAlert(data["result"]);
    					if(data["state"] == "success"){
    						location.reload();
    						window.parent.searchPage(1,10);
    					}
    				}
    			});
    		}
    	}
    	
    </script>
</body>
</html>